package com.shop.shop.dao;

import com.shop.shop.model.Good;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface GoodMapper {
    @Select("select * from good lock in share mode")
    public List<Good> getAllData();
    @Select("select restore from good where gid=#{goodId}")
    public Long getRetore(@Param("goodId") Long goodId);
    @Update("update good set restore = #{restore} where gid =#{goodId}")
    public Integer reduceRestore(@Param("restore") Long restore,@Param("goodId") Long goodId);
}
